#!/usr/bin/env python3

def checkBracket(s):
    stack = []

    for c in s:
        if c in "{([":
            stack.append(c)
        elif c in "})]":
            if not stack:
                return "缺少左括号!"
            ch = stack.pop()
            if ((c == ')' and ch != '(')
                    or (c == ']' and ch != '[')
                    or (c == '}' and ch != '{')):
                return "左右不匹配!"

    if stack:
        return "缺少右括号!"

    return s

def main():
    print(checkBracket(input("请输入一行字符串: ")))

if __name__ == "__main__":
    main()
